package com.dq.repository.user;

import com.dq.domain.position.OrgPosition;
import com.dq.domain.sys.section.SysSection;
import com.dq.domain.sys.user.user.StaffUser;
import com.dq.domain.sys.user.user.base.SysUser;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author luchangtong
 * @Date 2019/11/21 14:56
 */
@Repository
public interface StaffUserRepository extends JpaRepository<StaffUser,Long> {


    List<StaffUser> findBySectionAndUserRealcNameLikeOrderByCreateTimeDesc(SysSection sysDept, String name, Pageable pageable);
    Long countBySectionAndUserRealcNameLike(SysSection sysDept,String name);

    List<StaffUser> findBySectionAndUsernameLikeOrderByCreateTimeDesc(SysSection sysDept,String phone,Pageable pageable);
    Long countBySectionAndUsername(SysSection sysDept,String phone);

    StaffUser findByUsername(String username);


    List<StaffUser> findByDeletedAndSection(Boolean delete, SysSection org);
    List<StaffUser> findByDeletedFalse();

    List<StaffUser> findByOrgPositionAndDeletedFalse(OrgPosition orgPosition);

    List<StaffUser> findByCardNoAndDeletedFalse(String cardNo);

    StaffUser findByCardNoAndUserRealcNameAndDeletedFalse(String cardNo,String realName);


    /**
     * 手机号搜索
     */
    List<StaffUser> findByMobileAndDeletedFalse(String mobile);
}

